Conversation
cac2559 to
0c830ba
Compare
0c830ba to
599fd44
Compare
bdc167c to
0882483
Compare
stateChange events of V1 controllers with messenger, type fixes
|
@MajorLift in case of BaseControllerV1 without messagingSystem shouldn't we throw an error ? Or in this case I guess we would want only to save the initial state within the ComposableController ? |
|
@cryptodev-2s Hey thanks for taking a look at this! A This PR enables composable-controller to handle V1 controllers like |
6ef730e to
0fa97c3
Compare
0ab242a to
0fa97c3
Compare
… `stateChange` event
…trollerInstance`, as these are unsuited for general use
…sistency with `isBaseController` type guard
…rd<string, unknown>`
0fa97c3 to
7d46b06
Compare
mcmire
left a comment
There was a problem hiding this comment.
Looks mostly good! Just had one question.
| * | ||
| * The `BaseController` class itself can't be used directly as a type representing all of its subclasses, | ||
| * because the generic parameters it expects require knowing the exact shape of the controller's state and messenger. | ||
| * Note that this type is not the greatest subtype or narrowest supertype of all `BaseController` instances. |
| (isBaseControllerV1(controller) && 'messagingSystem' in controller) || | ||
| isBaseController(controller) | ||
| ) { | ||
| this.messagingSystem.subscribe( |
There was a problem hiding this comment.
If a BaseControllerV1 controller has a messagingSystem property, could the state of this controller could be updated twice per update? If so, do we still need an else if?
…controllers with messaging system Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Explanation
stateChangeevent.@metamask/utilsas a dependency.BaseControllerV{1,2}Instance,ControllerInstance, as these are incomplete and unsuited for general usage.isBaseController{,V1}are not removed.BaseControllerV2InstanceasBaseControllerInstancefor consistency withisBaseController.References
stateChangeevents of V1 controllers with messenger #3966Changelog
@metamask/composable-controllerChecklist